package com.tianyiyan.api;

import java.util.Date;

import com.tianyiyan.hibernate.user.User;

public class Session
{
	private Integer id;
	private String name;
	private String email;
	private Date createDate;

	private String privateToken;

	public Session(){}
	/**
	 * @brief 通过 User 构造Session
	 * @Note 确保 User 是从数据库中获取的
	 * 		 换句话说, Passwd 必须是摘要加密过后的
	 * @param user
	 */
	public Session(User user)
	{
		id = user.getId();
		name = user.getName();
		email = user.getEmail();
		createDate = user.getCreateDate();
		privateToken = user.getPasswd();
	}
	public Integer getId() {
		return id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getEmail() {
		return email;
	}
	
	public void setEmail(String email) {
		this.email = email;
	}
	
	public Date getCreateDate() {
		return createDate;
	}
	
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
	public String getPrivateToken() {
		return privateToken;
	}

	public void setPrivateToken(String privateToken) {
		this.privateToken = privateToken;
	}
}
